package com.zyd.shiro.persistence.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import com.zyd.shiro.persistence.beans.OrderGoods;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * 数据访问接口
 * @author Administrator
 *
 */
public interface MallOrderGoodsDao extends JpaRepository<OrderGoods,Integer>,JpaSpecificationExecutor<OrderGoods>{


    @Query(value = "select * from  mall_order_goods good where good.order_id = ?1",nativeQuery = true)
     List<OrderGoods> findAllByOrder_id(Integer orderId);

    @Query(value = "select COUNT(*) from  mall_order_goods good where good.order_id = ?1",nativeQuery = true)
    int findAllNumByOrder_id(Integer orderid);

}
